home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / strategy / vga_card.000 / vga_cardgames-1.3.1.tar / vga_cardgames / common.c < prev    next >
C/C++ Source or Header  |  1995-02-26  |  573b  |  44 lines

  1. /*
  2.  * Card games
  3.  *
  4.  * Copyright (C) Evan Harris, 1994, 1995.
  5.  *
  6.  * Permission is granted to freely redistribute and modify this code,
  7.  * providing the author(s) get credit for having written it.
  8.  */
  9.  
  10. #include <stdlib.h>
  11. #include <time.h>
  12. #include <vga.h>
  13.  
  14. #include "common.h"
  15.  
  16.  
  17. void
  18. EndDisplay()
  19. {
  20.     vga_setmode(TEXT);
  21. #if defined(CARDSMOUSE)
  22.     mouse_close();
  23. #endif    
  24. }
  25.  
  26.  
  27. void
  28. InitRandom(unsigned char state)
  29. {
  30.     static long seed;
  31.     
  32.     if (state == NEW) {
  33.     seed = time(NULL);
  34.     }
  35.     srand48(seed);
  36. }
  37.  
  38.  
  39. long
  40. Random(long max)
  41. {
  42.     return lrand48() % max;
  43. }
  44.